package com.design.memento.multistate;

import com.design.memento.multistate.Caretaker;

/**
 * @ClassName Client.java
 * @Description 多状态的备忘录模式
 * @author Jon
 * @date 2018年6月20日 下午5:44:07
 */
public class Client {
	public static void main(String[] args) {
		Originator ori = new Originator();
		Caretaker caretaker = new Caretaker();
		System.out.println("初始化状态：\n" + ori.toString());
		caretaker.setMemento(ori.createMemento());
		ori.setState1("A");
		ori.setState2("B");
		ori.setState3("C");
		System.out.println("修改后状态：\n" + ori.toString());
		ori.restoreMemento(caretaker.getMemento());
		System.out.println("恢复后状态：\n" + ori.toString());
	}
}
